HttpException is the base class for all HTTP exceptions in NestJS. Its constructor takes a response argument (string or object that becomes the response body), a status argument (the HTTP status code), and an optional options object. The options.cause property attaches an inner error for server-side logging without exposing it to the client.
response — a string or plain object. Strings are automatically wrapped as { message, statusCode }.
status — the HTTP status code. Use the HttpStatus enum for readability.
options.cause — an inner error attached for debugging; never serialized into the HTTP response body.
All NestJS built-in exceptions (NotFoundException, BadRequestException, etc.) extend HttpException.
Use HttpStatus enum constants instead of raw numbers for self-documenting code.